|
자주 쓰이는 메소드및 API 를 정리합니다. |
[1] |
|
등록일:2008-03-10 16:05:08 (0%) 작성자: 제목:Properties file은 어떤 경우에 쓰나요? |
|
Properties file을 써서 과제를 내라는데 뭘 어떻게 쓰라는지 이해가 잘 안갑니다.
어떤경우데 Properties file을 주로 쓰나요? 왜 쓰는지도 궁금합니다.
예제 있으면 올려주실수 있을까요?
감사합니다.!!
------------------------------------------------------------------------------------------
info.property 라는 파일에 이런 내용이 있다고 가정하면
# 환경설정 파일입니다
NAME=booler
ADDRESS=Seoul
소스를 보시면 NAME과 ADDRESS의 값을 쉽게 구할수 있습니다
String propertyFile = "info.property";
Properties ppt = new Properties();
try {
ppt.load(new FileInputStream(propertyFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
String name = ppt.getProperty("NAME");
String addr = ppt.getProperty("ADDRESS");
이상입니다.
|
[본문링크] Properties file은 어떤 경우에 쓰나요?
|
[1]
|
|
|
|
|
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=2473 |
|
|
|
|
|
|
|
|
|
Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.
|
|
|